 var id = getvl("id");
 var currentPage=1;
 $(function(){
 	   if(id!=null){
 	   	  huoqu();
 	   }else{
 	   	//alert("登录异常...");
 	   }
 });
 
 

 var ss=0;
function huoqu(){     
		if(currentPage==1 ||currentPage==2|| ss!=0){
		$.ajax({
             url:urlcore + "/api/myFoot/selectPage2?current="+currentPage+"&userId="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					ss=data.data.list.length;
						$.each(data.data.list,function(y,n){
			var shouchang='<div class="public_goods">'+
		      '<a href="../7.0.0goods_detail.html?id='+n.goods.id+'">'+
			'<dl>'+
				'<dt>'+
					'<img onerror="errorImg(this)" src="'+n.goods.coverUrl+'" />'+
				'</dt>'+
				'<dd>'+
					'<h5>'+n.goods.goodsTitle+'</h5>'+
					'<h6>&yen;'+n.goods.tradePrice+'- &yen;'+n.goods.getPrice+'</h6>'+
				'</dd>'+
			'</dl>'+
		'</a>';
		   if($(".p_header_right").html()=="编辑"){
		   		shouchang+='<div class="public_radio" name="1" onclick="binaji(this)">'+		//<!--删除-->
			'<div class="public_select">'+
                '<img src="../images/public_radio_default.png">'+
                '<input  type="checkbox" style="display: none;" value="'+n.id+'">'+
            '</div>'+ 
		'</div>'+
	'</div>';
		   }else{
		   		shouchang+='<div class="public_radio" name="1" onclick="binaji(this)" style="display: block;">'+		//<!--删除-->
			'<div class="public_select">'+
                '<img src="../images/public_radio_default.png">'+
                '<input  type="checkbox" style="display: none;" value="'+n.id+'">'+
            '</div>'+ 
		'</div>'+
	'</div>';
		   }

	         $("#shouchangdeshangping").append(shouchang);
						});
						
						
						$(function(){
	//编辑
	$('.p_header_right').on('click',function(){
		$(".p_header_right").html('删除');
		$("#quxiao").show();
		$("#back").hide(); 
		$(".public_radio").css("display","block")			
	});	
	$('.p_header_left').on('click',function(){
		$(".p_header_right").html('编辑');
		$("#quxiao").hide();
		$("#back").show(); 
		$(".public_radio").css("display","none")			
	});	
	
	
	//点击选中
})
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					//alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "../1.0.0denglu.html";
					}
				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});
		}
}
	
	
	
	function binaji(te){
		   if($(te).attr("name")==1){
		   	$(te).attr("name","2");
		   	$(te).find("input").attr("checked","checked");
			$(te).find("img").attr("src","../images/public_radio_selcet.png");
		   }else {
		   	$(te).attr("name","1");
		   	$(te).find("input").removeAttr("checked");
			$(te).find("img").attr("src","../images/public_radio_default.png");		
		   }
	}
 
 //数组list
function shanchu(){
	
	var list=[];
	$("input:checked").each(function(y,n){
		var shopid=$(this).val();
		    list.push({
		    	id:shopid
		    });
	});
		 if(list.length==0){
		 //	alert("未选择")
		 }else{
		 	//alert(list)
		 	 $.ajax({
		url: urlcore + "/api/myFoot/deleteMany",
		type: "post",
		contentType: "application/json;charset=utf-8",
		data: JSON.stringify(list),
		dataType: "json",
		success: function(data) {
			if(data.success == true) {
	 var sss= window.location.href;
		     window.location.href=sss;
              }
		},
		error: function() {
			alert("error");
		}
	});
	}
}